Hello!
I'm running a script on a Jenkins server, and I'm using the Excel Ole Object creation. On the Test server everything went well, however when we moved to the Live Server, the OLE Object creation fails. The code is the following:
oleExcel = oleCreateAutoObject("Excel. Application")
if(null oleExcel)
The error message happens only on the live server. The one running the Jenkins servers told me that there is no main difference between the two servers, they have the same Excel versions (2013), they are both capable of running excel and so on.
If any of you could help me with this problem, I'd be really grateful for it. Thank you very much in advance! HPM2BP - Mon Feb 27 07:03:48 EST 2017 | ||||||||||||||||||||||||
Re: Ole Object creation fails Please check, if Jenkins is run with a different user on the test system than on the live system. OLE usually makes problems, when you try to access it from a service that is started with the SYSTEM account on Windows. Regards, Mathias | ||||||||||||||||||||||||
Re: Ole Object creation fails Hello!
Thank you for your reply! I've just talked to the operator of the Jenkins server, and she told me that they are using the same user and credentials on both servers, and it really is a system user, if I understood it right, that she told me. Is there a workaround for this problem? Peter | ||||||||||||||||||||||||
Re: Ole Object creation fails You could also check the access rights for the named user in the production server. For OLE/COM the access rights can be set with DCOMCNFG tool (or at least was when I fought with similar issues): https://msdn.microsoft.com/en-us/library/windows/desktop/ms690141(v=vs.85).aspx | ||||||||||||||||||||||||
Re: Ole Object creation fails HPM2BP - Tue Feb 28 05:20:14 EST 2017 Hello!
Thank you for your reply! I've just talked to the operator of the Jenkins server, and she told me that they are using the same user and credentials on both servers, and it really is a system user, if I understood it right, that she told me. Is there a workaround for this problem? Peter I am not sure, what is causing the script to work on the test server but fail on the production server. Access rights can be an issue. Maybe you should rethink your approach. Running an DOORS Process, executing COM calls is maybe not such a good idea. You might get much more stable, if you generate CSV Data or XML data, which you can use as a Data Source inside your Excel Sheet (whithout even importing it).
What exactly are you doing with Excel from DOORS? Regards, Mathias | ||||||||||||||||||||||||
Re: Ole Object creation fails Thank you both for your answers!
@Mathias It's not exactly my script (I had to take over the development from the original developer), however if I understood it correctly, we need this OLE-object solution, because there is an inbuilt VBA script in the xlsm file, which automaticly updates the values of the sheets. (Contact informations, responsibilities, available resources, etc.), so we need to open this file at least once every time we run the script. The DXL script generates .csv outputs from this process, which later is used by further DXL scripts.
@PekkaMakinen 2c62fe98-76da-481f-be77-55155704a095I've written to the support, soon we'll try this out too (hopefully by tomorrow morning) | ||||||||||||||||||||||||
Re: Ole Object creation fails HPM2BP - Tue Feb 28 08:22:37 EST 2017 Thank you both for your answers!
@Mathias It's not exactly my script (I had to take over the development from the original developer), however if I understood it correctly, we need this OLE-object solution, because there is an inbuilt VBA script in the xlsm file, which automaticly updates the values of the sheets. (Contact informations, responsibilities, available resources, etc.), so we need to open this file at least once every time we run the script. The DXL script generates .csv outputs from this process, which later is used by further DXL scripts.
@PekkaMakinen 2c62fe98-76da-481f-be77-55155704a095I've written to the support, soon we'll try this out too (hopefully by tomorrow morning) There are always two options: a) You remote control DOORS from some application b) You control another application from DOORS In your case you do a+b, which means starting a DOORS job, that will then remote control another application (like Excel). I would not go this way, because DOORS gives you many headaches to debug problems. Instead what you should do is, have your jenkins job 1. start a DOORS process to extract the data to a file 2. open excel, start the macro, pull in the data from the file 3. if necessary convert the excel back to a CSV file, that the other DOORS processes can use I know that especially when you have a large script, that making that change can be too much effort, but especially if your script is in active development it will save you tons of time, not having to develop the data transformation parts in DXL. Regards, Mathias | ||||||||||||||||||||||||
Re: Ole Object creation fails Mathias Mamsch - Tue Feb 28 08:41:37 EST 2017 There are always two options: a) You remote control DOORS from some application b) You control another application from DOORS In your case you do a+b, which means starting a DOORS job, that will then remote control another application (like Excel). I would not go this way, because DOORS gives you many headaches to debug problems. Instead what you should do is, have your jenkins job 1. start a DOORS process to extract the data to a file 2. open excel, start the macro, pull in the data from the file 3. if necessary convert the excel back to a CSV file, that the other DOORS processes can use I know that especially when you have a large script, that making that change can be too much effort, but especially if your script is in active development it will save you tons of time, not having to develop the data transformation parts in DXL. Regards, Mathias This is a possible solution, however this workaround would take a lot more time, and the main problem is that this method has been working on literally every platform, except the live server. We've been running it from 5 different PCs, 4 virtual PCs, and the test server. On the PCs we don't even have admin rights. (Also to correct myself, we are pulling data first from the Excel, we process that data later in the DXL)
The solution in our case right now is a)+b) for a full automation. We have to run the DXL script without opening the actual Doors, in a way something like this: "c:\Program Files (x86)\IBM\Rational\DOORS\9.6\bin\doors.exe" -data *********************** -batch **************\main.dxl -osuser -a *************\\2017v2 -dxl "string sPathNull=\"**************\\2017v2\" " (I had to star out some parts) Also we are in kind of at the end of the development, since the very last step is supposed to be moving the script from the test server to the live server.
So in short, this method has been working in several environments, and a new workaround would take up way too many effort from our side. Could you please recommend a forum where people discuss this field (OLE objects and COM)? I'd post the problem in that case there too.
Thank you and have a nice evening! | ||||||||||||||||||||||||
Re: Ole Object creation fails HPM2BP - Tue Feb 28 10:43:41 EST 2017 This is a possible solution, however this workaround would take a lot more time, and the main problem is that this method has been working on literally every platform, except the live server. We've been running it from 5 different PCs, 4 virtual PCs, and the test server. On the PCs we don't even have admin rights. (Also to correct myself, we are pulling data first from the Excel, we process that data later in the DXL)
The solution in our case right now is a)+b) for a full automation. We have to run the DXL script without opening the actual Doors, in a way something like this: "c:\Program Files (x86)\IBM\Rational\DOORS\9.6\bin\doors.exe" -data *********************** -batch **************\main.dxl -osuser -a *************\\2017v2 -dxl "string sPathNull=\"**************\\2017v2\" " (I had to star out some parts) Also we are in kind of at the end of the development, since the very last step is supposed to be moving the script from the test server to the live server.
So in short, this method has been working in several environments, and a new workaround would take up way too many effort from our side. Could you please recommend a forum where people discuss this field (OLE objects and COM)? I'd post the problem in that case there too.
Thank you and have a nice evening! I understand. Lets try to be productive about finding the original problem. I hope you can have access to the production machine to perform some tests. I would check the following things: 1. Working Excel Installation on Production PC - Can you create an Excel application object from any Application on the Production Server: - e.g. vom Visual Basic Script - or from DOORS in Interactive Mode (with a minimal DXL script) - Does the production PC have registry entries for the Excel COM Server ( HKCR / Excel.Application) and is its class ID registered correctly under HKCR / CLSID? You can also replace "Excel.Application" by "MSXML.DOMDocument" or "WScript.Shell" to test general OLE functionality. 2. Can you create an OLE instance from a service? For this I would download nssm (https://github.com/kirillkovalenko/nssm) and use it to install the following VBScript as a service (nssm create testservice)
Set objExcel = CreateObject("Excel.Application")
If objExcel is Nothing then WScript.echo "Nope" else WScript.echo "Yap!"
Redirect the output of the process to a file using nssm and check the output of the file after starting. This way you can determine if this is a special problem with DOORS or if this is about the service and the service user (provided that the steps in 1. worked). If 1 and 2 work, this seems to be a DOORS problem. 3. Can you create an OLE from DOORS? Use nssm to change the service to a minimal batch dxl script:
OleAutoObj ole = oleCreateAutoObject("MSXML.DOMDocument");
if (null ole) cout << "NULL"; else cout <<"OK";
oleCloseAutoObject ole
Start it from the nssm service using doors.exe -u user -P password -w -l C:\temp\out.txt -b script.dxl Verify that you get "OK" in the redirected output, if so change the MSXML.DOMDocument to Excel.Application. If that does not work, you can incorporate the Process Monitor of Sysinternals to find the registry keys and files that the DOORS client tries to open when running the DXL. Maybe this will give you some insights into access problems. Maybe that helps, Regards, Mathias | ||||||||||||||||||||||||
Re: Ole Object creation fails Thank you for all the options!
Unfortunately I don't have access to the server, only the operators can reach it. I'll ask one of them to try these out. We'll do it on Friday (Time Zone differences and meetings, and so on). I'll post the results once we've tried these.
Thank you once again, I'm very grateful for your time and help! Peter | ||||||||||||||||||||||||
Re: Ole Object creation fails Hello!
First of all, sorry for the late reply! We did a quick test today, and when we manually ran the Doors DXL, we could create the Excel OLE object. When we invite the DXL script through jenkins, we are logging on to Doors with the "-osuser" command. On Friday we will run further tests (runnin the script from CMD), however I think the error's source will be the "-osuser".
Is there any detailed topic about launching a DXL script from command line? I'm mainly interested about changing the "-osuser" to something else, and how to do that.
Thank you very much in advance! | ||||||||||||||||||||||||
Re: Ole Object creation fails HPM2BP - Tue Mar 07 07:59:16 EST 2017 Hello!
First of all, sorry for the late reply! We did a quick test today, and when we manually ran the Doors DXL, we could create the Excel OLE object. When we invite the DXL script through jenkins, we are logging on to Doors with the "-osuser" command. On Friday we will run further tests (runnin the script from CMD), however I think the error's source will be the "-osuser".
Is there any detailed topic about launching a DXL script from command line? I'm mainly interested about changing the "-osuser" to something else, and how to do that.
Thank you very much in advance! It does not matter what user you pass to the commandline in DOORS. The matter is more, which system user starts the DOORS exe process (which can be completely different from the DOORS user under which the DXL is executed). It seems weird that you start DOORS using the osUser command. That would mean, that the system user that jenkins runs with, is associated inside DOORS with some DOORS user? Regards, Mathias EDIT: When you want to change the user that executes the DOORS process, take a look at the psexec tool from sysinternals! | ||||||||||||||||||||||||
Re: Ole Object creation fails It seems so, yeah, we will try running the DXL from command line from the test server's PC itself, and from the Jenkins' input command line too, will see the difference hopefully real soon.
I'll update you about the results, and if we've found the possible solution. Thank you very much! Peter | ||||||||||||||||||||||||
Re: Ole Object creation fails Hello!
Sorry about the late reply, it took for a while to figure out everything. It seems that the Jenkins job doesn't have admin rights, and for security reasons we can't ask for admin rights on the live server. This means without admin rights we can't use the ole excel solution. Will do the alternative with python, because it's allowed to do so.
What may cause the problem is that the Jenkins task is running as a Service, not as a Person. On my virtual PC I was able to run the script without admin rights, however I assume my test run wasn't considered as a service.
Once again thank you very much for all your help and ideas, the final result will be a python extraction, and a .csv processing with DXL.
Regards, | ||||||||||||||||||||||||
Re: Ole Object creation fails HPM2BP - Tue Mar 21 10:41:12 EDT 2017 Hello!
Sorry about the late reply, it took for a while to figure out everything. It seems that the Jenkins job doesn't have admin rights, and for security reasons we can't ask for admin rights on the live server. This means without admin rights we can't use the ole excel solution. Will do the alternative with python, because it's allowed to do so.
What may cause the problem is that the Jenkins task is running as a Service, not as a Person. On my virtual PC I was able to run the script without admin rights, however I assume my test run wasn't considered as a service.
Once again thank you very much for all your help and ideas, the final result will be a python extraction, and a .csv processing with DXL.
Regards, Wait, I remember something. I remember it was sufficient to run the DOORS client one time only with the user Administrator to be able to use COM on the client. We experienced the same problem with the DXL Debugger of Sodius. It needs to be the user "Administrator", not just any user with admin rights. After you started the client once on the PC, afterwards it is possible to use COM with every user. You may want to try this, before completely replacing the technology. Regards, Mathias | ||||||||||||||||||||||||
Re: Ole Object creation fails Mathias Mamsch - Tue Mar 21 12:07:53 EDT 2017 Wait, I remember something. I remember it was sufficient to run the DOORS client one time only with the user Administrator to be able to use COM on the client. We experienced the same problem with the DXL Debugger of Sodius. It needs to be the user "Administrator", not just any user with admin rights. After you started the client once on the PC, afterwards it is possible to use COM with every user. You may want to try this, before completely replacing the technology. Regards, Mathias Hello Peter & Mathias, I remember this a little differently: In my experience, you had to start DOORS client on the PC once with elevated Windows privileges (right mouse button: Run as Admin -- btw. that is even necessary if you are logged in as a user with administrator rights) for the COM component to register correctly. You say that your user is not allowed to have admin rights, but this is not so much a problem, you only need to ask a person to enter his credentials once...
Better you just try both solutions.
Regards, | ||||||||||||||||||||||||
Re: Ole Object creation fails Hello!
I think I haven't explained the situation that well. On my personal company laptop I don't have Admin rights at all. I can request them, but that's a complicated process and is only valid for 8 hours. (By this I meant to show that assumingly no process that we run have administrative rights). The process I'm using is running the DXL script from a *.dxl file. I'm running the script from CMD with the following line: "c:\Program Files (x86)\IBM\Rational\DOORS\9.6\bin\doors.exe" -data *********************** -batch **************\main.dxl -osuser -a *************\\2017v2 -dxl "string sPathNull=\"**************\\2017v2\" "
(Obviously I replaced a few parts with * characters because of company secrets, and so on). I'm entirely sure that I don't have administrative rights, because it isn't displayed where it should by when I'm running whoami /all We are running the script with almost the same command line from Jenkins, and there comes the problem about not being able to create an oleobject.
Something which may help is the following table I made. These are the results given for the whoami /all ran in the different
Also we cannot run anything as administrator for safety reasons without requesting the rights in the local system and the request being accepted. Hope this helps a bit.
I'll try to arrange it to be able to run the whole process once with admin rights, I hope it will solve the problem. I'll inform you about that case too. Thank you! Regards, Peter | ||||||||||||||||||||||||